package com.itheima.mall.web.oms;

import com.itheima.mall.pojo.oms.OrderSetting;
import com.itheima.mall.service.oms.OrderSettingService;
import com.itheima.mall.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/orderSetting")
public class OrderSettingController {
    @Autowired
    private OrderSettingService orderSettingService;

    /**
     * 修改指定订单设置
     * @param id
     * @param orderSetting
     * @return
     */
    @PostMapping("/update/{id}")
    public R update(@PathVariable("id") Integer id,
                    @RequestBody OrderSetting orderSetting){
        orderSettingService.update(id,orderSetting);
        return R.succeed(null,"操作成功");
    }

    /**
     * 获取指定订单设置
     * @param id
     * @return
     */
    @GetMapping("/{id}")
    public R findById(@PathVariable("id") Integer id){
        OrderSetting orderSetting = orderSettingService.findById(id);
        return R.succeed(orderSetting,"操作成功");
    }
}
